/** @ingroup terminal
 * @file font.h
 * @brief fonts and font mapping
 *
 * fonts are created with H. Reddmann's FontEditor
 *
 * @author cameris camerisdump@gmail.com
 */

#ifndef _FONT_H_
#define _FONT_H_

#include <stdint.h>

#define FONT_WIDTH 8
#define FONT_HEIGHT 15

#define FONT_UNDERLINE_POS (FONT_HEIGHT-2) /**< @brief position of underline */

#define FONT_HEADER_SIZE 7 /**< @brief bytes till charwidth field */

struct charbuf;

/** @brief font names */
enum fonts { 
	FONT_C0 = 0,
	FONT_C1,
	FONT_ASCII,
	FONT_LATIN1,
	FONT_GRAPHIC,
	MAX_FONTS, /* maximal 8 fonts, since struct charbuf.font 
				  is only 3 bit wide */
};

/** @brief selected names */
enum selectslot {
	G0 = 0,
	G1,
	G2,
	G3,
	MAX_SELECT,
	NO_SS, /**< @brief dummy to indicate no saved single shift */
};

/** @brief active names */
enum activeslot {
	GL = 0,
	GR,
	MAX_ACTIVE,
};

void font_reset(void);
void font_set_active(enum activeslot active, enum selectslot select);
void font_set_selected(enum selectslot select, enum fonts font);
void font_set_singleshift(enum selectslot select);
void font_save_state(void);
void font_restore_state(void);
enum selectslot font_get_selected(enum activeslot active);
enum fonts  font_get_font(enum selectslot select);
uint_fast8_t font_get_setwidth(enum fonts font);
void font_draw_char(uint_fast8_t x, uint_fast8_t y, struct charbuf *cb);

#endif
